<?php 
	session_start();
	ob_start();
	$form_id=$_POST['frmId'];
	include("connection/connection.php");
	$district_name=$_SESSION['dis_name'];
	$folder1='index_map_rwss/'.$district_name;
	//$folder1=$district_name;
	if(!is_dir($folder1))
	{
		mkdir($folder1, 0777);
	}
		$flname1=$_FILES['ind_map']['name'];
		//echo $flname123=$_FILES['ind_map']['type'];
		$flname1=$form_id . "-" . $flname1;
		if($flname1!='')
		{
		if($_FILES['ind_map']['type']!="pdf")
		{
		
		}
			$dir=$folder1.'/';
			//echo '<br>';
			//echo $dir;
			$upfile=$dir.$flname1;
			move_uploaded_file($_FILES['ind_map']['tmp_name'], $upfile); 
		//echo "<script>alert('Index map file is successfully uploaded')\n";
		//echo "";	
		$success1='Index map file is successfully uploaded';
	}
	
	
	
	$q1="UPDATE tbl_dtls_q1_main SET index_map='$flname1' WHERE id='$form_id'";
		//echo $q1;
		$r1=mysql_query($q1);
		if($r1)
		{
			header('Location:q1_rwss_edit.php');
			
		}
		else
		{
			echo "Error! File not uploaded";
		}			
?>